<style>
.fui-btn-c {
    height: auto;
    background: #db232b;
    margin: 0.6rem 0.3rem;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
	box-shadow: 0 8px 6px #fcb8c0;
    align-items: center;
	color:#fff;
    position: relative;
	border-radius:2rem;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.weui_cells_radio2 .weui_check:checked + .weui_icon_checked:before {
  color: #db232b;
}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#db232b;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
</style>
<div class="fui-page">
	<div class="fui-content">
		<div class="fui-page-title r-f" style="font-size:0.7rem"><span>欢迎您 {{pagedata.member.nickname}}</span><span ng-if="!pagedata.member.nickname" ng-click="access_json('jy_weidish/home/')" style="margin-left:1rem;color:#db232b">登录</span><i class="icon icon-bangzhuxiantiao" style="color:#db232b;margin-left:1rem"></i></div>
		<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:6rem">
				<div ng-class="{'item':1, 'active':$index==0}" ng-repeat="nav in pagedata.pluginset.hdps">
					<a href="{{nav.url}}">
						<img ng-src="{{tomedia(nav.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
					</a>
				</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="nav in pagedata.shopset.hdps" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>
		<div class="fui-page-title" style="text-align:left">
		  <div style="font-size:0.8rem">下午好，{{pagedata.member.nickname}}</div>
		  <div><i class="icon icon-map" style="color:red"></i> <span class="subtitle">附近门店：{{pagedata.list[0].title}} 约{{pagedata.list[0].juli}}公里</span></div>
		</div>
		<a href="javascript:;" ng-click="access_json('jy_weidish/search/')" class="fui-btn-c">
			<i class="icon icon-cart1"></i>
			<div class="info"><div class="bold" style="line-height:1">开始{{pagedata.pluginset.buytitle || '点餐'}}</div><div style="line-height:1">order now</div></div>
		</a>
		<div class="fui-cell-group fui-cell-click" style="margin-top: 0">
		<a class="fui-cell external" href="javascript:;" ng-click="access_json('jy_weidish/orderlist/')">
			<div class="fui-cell-icon"><i class="icon icon-quanbudingdan"></i></div>
			<div class="fui-cell-text">我的订单</div>
			<div class="fui-cell-remark" style="font-size: 0.65rem;">查看全部订单</div>
		</a>
		<div ng-class="{'fui-icon-group selecter':1, 'col-3':!pagedata.pluginset.pinpailink, 'col-4':pagedata.pluginset.pinpailink}">
			<a class="fui-icon-col external" href="javascript:;" onclick="$('#show_vipcard').modal();" >
				<div class="icon icon-green radius"><i class="icon icon-fukuanma" style="color:#db232b"></i></div>
				<div class="text">会员码</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="access_json('jy_coupon/myindex/')">
				<div class="icon icon-orange radius"><i class="icon icon-daifukuan1" style="color:#db232b"></i></div>
				<div class="text">我的卡包</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="access_json('jy_weidish/self/detail/')">
				<div class="icon icon-blue radius"><i class="icon icon-paihao0" style="color:#db232b"></i></div>
				<div class="text">我的排号</div>
			</a>
			<a ng-if="pagedata.pluginset.artid" class="fui-icon-col external" href="javascript:;" ng-click="access_json('core/article.list/detail/onlycontent=1&id='+pagedata.pluginset.artid)">
				<div class="icon icon-blue radius"><i class="icon icon-dianpu" style="color:#db232b"></i></div>
				<div class="text">品牌介绍</div>
			</a>
		</div>
		<div ng-if="pagedata.pluginset.no_cube!=1" class="fui-picturew row-2" style="padding: 0 0.15rem">
                <a ng-repeat="item in pagedata.pluginset.cube" ng-if="$index<=1" class="item" style="padding: 0.15rem;">
                    <div class="image">
                        <img ng-src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}">
                    </div>
                </a>
		</div>
		<div class="fui-list-group merchgroup">
					<div class="fui-list" ng-repeat="item in pagedata.list">
						<a class="fui-list-media storelogo" href="javascript:;" ng-click="pagedata.selectstore($index);">
							<img class="round" ng-src="{{tomedia(item.logo) || '../core/resource/images/nopic.jpg'}}">
						</a>
						<a class="fui-list-inner" style="margin-top:0.16rem" href="javascript:;" ng-click="pagedata.selectstore($index);">
							<div class="title" style="font-size:0.76rem">{{item.title}}</div>
							<div class="subtitle">
								<i class="icon icon-map" style="color:red;font-size:0.6rem"></i> <span style="color:#999">{{item.address || '该门店还未填写地址'}}</span>
							</div>
							<div class="subtitle" style="font-size:0.55rem">
								<div class="store-moneylimit" ng-if="item.out_juli>=item.juli">
								  <span>¥ <span style="color:#22ad0c">{{pagedata.pluginset.out_price || 10}}.00</span> 起送 </span> | 
								  <span> 配送费¥<span style="color:#22ad0c"> {{item.out_pay|| pagedata.pluginset.out_fee +'.00'}}</span></span>
								  <span class="store-distance">{{item.juli || 0}}km | 约{{item.peisongtime || 50}}分钟</span>
								</div>
								<div class="store-moneylimit" ng-if="item.out_juli<item.juli">
								  <span><span style="color:#22ad0c">超出</span>配送范围({{item.out_juli}}km)</span> | 
								  <span> 配送费¥<span style="color:#22ad0c"> {{item.out_pay|| pagedata.pluginset.out_fee +'.00'}}</span></span>
								  <span class="store-distance">{{item.juli || 0}}km | 超出</span>
								</div>
							</div>
						</a>
				</div>
		</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
	</div>
</div>
</div>
<div id="show_vipcard"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
		<div class="modal-dialog" style="top:30%;">
			<div class="memlogo-area" style="background:url({{tomedia(pagedata.member.cardbg) || '../core/resource/images/cardbg.png'}}) no-repeat 100%">
                    <div class="memlogo">
                        <img ng-src="{{tomedia(pagedata.member.avatar) || '../core/resource/images/gw-user.png'}}">
                    </div>
                    <div class="name">{{pagedata.member.nickname || '匿名'}}</div>
                    <br>
                    <div class="name">{{pagedata.member.mobile || '无手机号'}}</div>
                    <div class="code">
                        <img ng-src="{{tomedia(pagedata.pluginset.logo) || '../addons/jy_weidish/resource/images/logo.png'}}">
                    </div>
                    <div class="bot">
						<img id="barcode"/>
                        <span class="r-f">{{pagedata.member.group}}</span>
                    </div>
            </div>
		</div>
</div>
<div ng-if="pagedata.showorder_type" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="height:auto;overflow-y:scroll">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showorder_type=false"></i>
			<div class="fui-page-title" style="margin-top:1rem;padding:0 0.6rem;text-align:left">
			  <div style="font-size:0.8rem">{{pagedata.post.title}}</div>
			  <div><span class="subtitle"><i class="icon icon-map" style="font-size:0.6rem;color:red"></i> {{pagedata.post.address || '门店详细地址'}}</span></div>
			</div>
			<div class="weui_cells weui_cells_radio2">
				<label ng-if="pagedata.pluginset.down_send_type2 !=1" class="weui_cell weui_check_label" for="x21">
					<div class="weui_cell_hd">
						<input type="radio" class="weui_check" value="2" ng-model="pagedata.post.sendtype" ng-checked="pagedata.post.sendtype==2" id="x21">
						<span class="weui_icon_checked"></span>
					</div>
					<div ng-class="{'weui_cell_bd weui_cell_primary':1,'red':pagedata.post.sendtype==2}">
						<div>现在点餐 支付成功后取餐</div>
						<div>Now</div>
					</div>
				</label>
				<label ng-if="pagedata.pluginset.down_send_type1 !=1" class="weui_cell weui_check_label" for="x22">
					<div class="weui_cell_hd" ng-if="pagedata.nowstore.out_juli>=pagedata.nowstore.juli">
						<input type="radio" class="weui_check" value="1" ng-model="pagedata.post.sendtype" ng-checked="pagedata.post.sendtype==1" id="x22">
						<span class="weui_icon_checked"></span>
					</div>
					<div class="weui_cell_hd" ng-if="pagedata.nowstore.out_juli<pagedata.nowstore.juli">
						<input type="radio" class="weui_check" value="1" readonly>
						<span class="weui_icon_checked readonly"></span>
					</div>
					<div ng-if="pagedata.nowstore.out_juli>=pagedata.nowstore.juli" ng-class="{'weui_cell_bd weui_cell_primary':1,'red':pagedata.post.sendtype==1}">
						<div>外卖配送 支付成功后配送</div>
						<div>Now out</div>
					</div>
					<div ng-if="pagedata.nowstore.out_juli<pagedata.nowstore.juli" ng-class="{'weui_cell_bd weui_cell_primary':1,'red':pagedata.post.sendtype==1}">
						<div style="color:red">超出配送范围(您可以选择其他附近的{{pagedata.pluginset.storeunit || '门店'}})</div>
						<div>Out In</div>
					</div>
				</label>
				<label ng-if="pagedata.pluginset.down_send_type3 !=1" class="weui_cell weui_check_label" for="x23">
					<div class="weui_cell_hd">
						<input type="radio" class="weui_check" value="3" ng-model="pagedata.post.sendtype" id="x23" ng-checked="pagedata.post.sendtype==3">
						<span class="weui_icon_checked"></span>
					</div>
					<div ng-class="{'weui_cell_bd weui_cell_primary':1,'red':pagedata.post.sendtype==3}">
						<div>预约点餐 预约当天 签到后取餐</div>
						<div>Later</div>
					</div>
					<div class="weui_cell_ft">
					</div>
				</label>
			</div>
			<div ng-if="pagedata.post.sendtype!=1 && (pagedata.pluginset.down_send_type3 !=1 || pagedata.pluginset.down_send_type2 !=1)" class="col-jy" style="padding:0.5rem">
				<div class="subtitle">请选择就餐方式</div>
				<div class="col-jy-2">
					<a href="javascript:;" ng-click="access_json('jy_weidish/goodslist//self_type=1&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype)" class="fui-btn-c">
						<i class="icon icon-shipin"></i>
						<div class="info"><div class="bold" style="line-height:1">店内就餐</div><div style="line-height:1">Dine IN</div></div>
					</a>
				</div>
				<div class="col-jy-2">
					<a href="javascript:;" ng-click="access_json('jy_weidish/goodslist//self_type=0&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype)" class="fui-btn-c">
						<i class="icon icon-gifts"></i>
						<div class="info"><div class="bold" style="line-height:1">打包带走</div><div style="line-height:1">Take Away</div></div>
					</a>
				</div>
			</div>
			<div ng-if="pagedata.post.sendtype==1 && pagedata.pluginset.down_send_type1 !=1" class="col-jy" style="padding:0.5rem">
				<div class="subtitle">请选择配送时间</div>
				<div class="col-jy-2">
					<a href="javascript:;" ng-click="access_json('jy_weidish/goodslist//make_type=0&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype)" class="fui-btn-c">
						<i class="icon icon-peisong"></i>
						<div class="info"><div class="bold" style="line-height:1">{{pagedata.pluginset.on_feejia==1?'加急配送':'立即配送'}}</div><div style="line-height:1">Dine IN</div></div>
					</a>
				</div>
				<div class="col-jy-2">
					<a href="javascript:;" ng-click="pagedata.selecttime()"  class="fui-btn-c">
						<i class="icon icon-daishouhuo1"></i>
						<div class="info"><div class="bold" style="line-height:1">预约配送</div><div style="line-height:1">Take Away</div></div>
					</a>
				</div>
			</div>
			<div ng-if="pagedata.post.sendtype==2 && pagedata.pluginset.down_send_type3 ==1 && pagedata.pluginset.down_send_type2 ==1" class="col-jy" style="padding:0.5rem">
				<div class="col-jy-2">
					<a class="fui-btn-c" style="background:#f1f1f1;box-shadow: 0 8px 6px #f1f1f1;">
						<i class="icon icon-peisong" style="color:#999"></i>
						<div class="info"><div class="bold" style="line-height:1;color:#999">{{pagedata.pluginset.on_feejia==1?'加急配送':'立即配送'}}</div><div style="line-height:1;color:#999">Dine IN</div></div>
					</a>
				</div>
				<div class="col-jy-2">
					<a href="javascript:;" ng-click="access_json('jy_weidish/goodslist//make_type=0&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype)"  class="fui-btn-c">
						<i class="icon icon-tuwenwenzhen"></i>
						<div class="info"><div class="bold" style="line-height:1;">随便逛逛</div><div style="line-height:1;color:#999">Look Away</div></div>
					</a>
				</div>
			</div>
		</div>
	</div>
</div>
<div id="selecttime" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:100%;bottom:0%;left:0%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="color:#ddd;top:0.2rem;right:0.2rem"><i class="icon icon-wrong" style="font-size:1.3rem;"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text red" style="background-color:#fff" >请选择送达时间</div>
		</div>
		<div class="row margin0">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li ng-class="{'active':pagedata.post.dayid==$index}" ng-repeat="(key,value) in pagedata.out_time.days"><a href="javascript:;" ng-click="pagedata.post.dayid=$index">{{value}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9" style="padding-left:0;padding-bottom:1rem">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal" style="height:19rem">
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="time-flag"><a href="javascript:;" ng-click="access_json('jy_weidish/goodslist//make_type=1&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype+'&out_time='+pagedata.predict_time+'&dayid='+pagedata.post.dayid)">尽快送达 <span>(配送费￥{{pagedata.out_time.times[0].out_pay}})</span></a></li>
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="delivery-tips time-flag" style="color:red">约{{pagedata.predict_time}}送达</li>
								<li ng-repeat="item in pagedata.out_time.times" ng-click="access_json('jy_weidish/goodslist//make_type=1&id='+pagedata.post.id+'&sendtype='+pagedata.post.sendtype+'&out_time='+item.timev+'&dayid='+pagedata.post.dayid)" ng-class="{'hide init-hide':(item.timestamp <= pagedata.timestamp && pagedata.post.dayid==0)}">
									<a href="javascript:;">{{item.timev}} <span>({{item.out_pay}})</span></a>
								</li>
								<div class="content-empty" ng-show="pagedata.out_time.lasttimebox == 0 && pagedata.post.dayid==0">
									  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">当天没有配送时间段！</p>
								</div>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</div>
<div ng-include="sys_html('common/_welcomehdp',true)"></div>
<script type="text/javascript">
scope.pagedata.params={}
scope.pagedata.post={'sendtype':2,'dayid':0}
// 百度地图API功能
window.scope.location(function(re){
	re=re?re:{}
	var lat_lng = re.lat_lng?re.lat_lng:{};
	scope.tool.get_list('jy_weishop/store.index/getlist/limit=5&lat='+lat_lng.lat+'&lng='+lat_lng.lng,true);
});
scope.pagedata.selectstore=function(index){
	scope.pagedata.showorder_type=true;
	scope.pagedata.nowstore=scope.pagedata.list[index];
	if(scope.pagedata.nowstore.out_juli<scope.pagedata.nowstore.juli){
		scope.pagedata.post.sendtype=2;
	}else{
		scope.pagedata.post.sendtype=1;
	}
	scope.pagedata.post.id=scope.pagedata.nowstore.id;
	scope.pagedata.post.title=scope.pagedata.nowstore.title;
	scope.pagedata.post.address=scope.pagedata.nowstore.address
}
scope.pagedata.selecttime=function(){
	$('#selecttime').modal();
	var store_id=scope.pagedata.post.id
	scope.get('jy_weidish/index/out_time/store_id='+store_id,function(res){
		scope.pagedata.out_time=res.out_time;
		scope.pagedata.predict_time=res.predict_time;
		scope.pagedata.timestamp=res.timestamp;
		scope.$evalAsync();
	});
}
</script>
<script>
	require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
	});
</script>
<script>
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.nowmsgid=0;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.pluginset.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.pluginset.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
require(['JsBarcode'],function(JsBarcode){
	//console.log('准备调用');
	JsBarcode('#barcode',scope.pagedata.member.barcode,{fontSize:36});
});
</script>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<div ng-include="sys_html('common/_coupon',true)"></div>
<div ng-include="sys_html('common/_h5game',true)"></div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_sales','','','jy_weishop')"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>